﻿using BLL;
using MODEL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Loginter.成本核算
{
    public partial class ChengBenWeiHu : System.Web.UI.Page
    {
        CarrierBLL carbll = new CarrierBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                GetCarrireInfo();
            }
        }

        private void GetCarrireInfo()
        {
            int data =Convert.ToInt32(radio_state.SelectedValue);
            DateTime? receivedate_in = null;
            if (!string.IsNullOrWhiteSpace(txt_date.Text.Trim()))
            {
                receivedate_in = Convert.ToDateTime(txt_date.Text);
            }
            DateTime? receivedate_end = null;
            if (!string.IsNullOrWhiteSpace(txt_this.Text.Trim()))
            {
                receivedate_end = Convert.ToDateTime(txt_this.Text);
            }
            CarrierMODEL info = new CarrierMODEL()
            {
                FinishedState=data,
                ReceiveDate_in=receivedate_in,
                ReceiveDate_end=receivedate_end
            };
            List<CarrierinfoMODEL> list = carbll.GetCarrerInfo(info);
            grid_chengben.DataSource = list;
            grid_chengben.DataBind();
        }


        /// <summary>
        /// 重置按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btn_chongzhi_Click(object sender, EventArgs e)
        {
            radio_state.SelectedValue = "0";
            txt_date.Text = "";
            txt_this.Text = "";
        }

        protected void btn_jiansuo_Click(object sender, EventArgs e)
        {
            GetCarrireInfo();
        }
        
    }
}